import java.util.*;
public class Spoj02{
	
	public static void main(String args[]){
		
		Scanner scanner= new Scanner(System.in);
		Stack stack = new Stack();
		int arraycounter=0;
		
		while(scanner.hasNextLine()) {
	
					String string=scanner.next();
				    
					stack.add(string);	//add the word to a stack 
					
				    if(string.equals("EOF")){
				    	stack.pop(); //remove EOF from stack as it would have been added above
				    	break; 		//exit the loop
				    }
		}
         scanner.close();
         String[] word_array =new String[stack.size()];
		
         for(int i=0; i<word_array.length;i++){
        	 word_array[i]=stack.pop().toString();
         }
         
         Arrays.sort(word_array);//this sorts the array thus no need to sort subgroups
         
         for (int i=0;i<word_array.length;i++){
        	String string=word_array[i];
        	 
        	 
        	 if(string!=" "){
        		
        		 for(int j=i+1;j<word_array.length;j++){
        			 
        			 if(word_array[j].length()==string.length()){
        				
        				 Boolean value=checkChar(word_array[j], string);
        				 
        				 if(value ==true);
        				 
        			 }
        		 }	
        	 }
        	
         }
	}
	
	public static boolean checkChar(String b, String a){
		
		for(int i=0;i<a.length();i++){
			
			char Char=a.charAt(i);
			
			for (int j=0;j<a.length();j++){
				
				if(Char==b.charAt(j)) break;
				
				else if(j+1==a.length()) return false;
			}
		}
		return true;
	}
}